package com.example.demo.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

@RestController
public class ChatController {

    @RequestMapping("/dui")
    public String chat(@RequestParam(name = "s")String s){
        System.out.println(s);
        try {
            InputStreamReader ir = new InputStreamReader(System.in,"UTF-8");
            char[] buffer = new char[10];
            ir.read(buffer);
            String ss=String.valueOf(buffer);
            return ss;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }
}
